{$contents}

{literal}
<div style="text-align:left; padding:10px;">
<h2>Source</h2>

<pre class="code">
&lt;?php
$post = DomFgPost::getInstance();
		
$arrayValue = array('key'=>array('value'=>'VALUE'));
$source = new DomFgDataSource(array(
	array('id'=>0,'name'=>'Oliver','age'=>15,'array'=>$arrayValue),
	array('id'=>2,'name'=>'Getter','age'=>25,'array'=>$arrayValue),
	array('id'=>3,'name'=>'Jaanika','age'=>12,'array'=>$arrayValue),
	array('id'=>5,'name'=>'SSS','age'=>54,'array'=>array()),
	array('id'=>6,'name'=>'Oliver','age'=>15,'array'=>$arrayValue),
	array('id'=>7,'name'=>'Mari','age'=>23,'array'=>$arrayValue),
	array('id'=>8,'name'=>'Getter','age'=>25,'array'=>$arrayValue),
	array('id'=>9,'name'=>'SSSS','age'=>12,'array'=>$arrayValue),
	array('id'=>0,'name'=>'Oliver','age'=>15,'array'=>$arrayValue),
	array('id'=>1,'name'=>'Mari','age'=>23,'array'=>$arrayValue),
	array('id'=>2,'name'=>'Getter','age'=>25,'array'=>$arrayValue),
	array('id'=>3,'name'=>'Jaanika','age'=>12,'array'=>$arrayValue),
	array('id'=>4,'name'=>'Anne','age'=>23,'array'=>$arrayValue),
	array('id'=>5,'name'=>'Wrony','age'=>54,'array'=>array()),
	array('id'=>6,'name'=>'SSSSA','age'=>15,'array'=>$arrayValue),
	array('id'=>7,'name'=>'Mari','age'=>23,'array'=>$arrayValue),
	array('id'=>8,'name'=>'Getter','age'=>25,'array'=>$arrayValue),
	array('id'=>9,'name'=>'Jaanika','age'=>12,'array'=>$arrayValue),
	array('id'=>0,'name'=>'Oliver','age'=>15,'array'=>$arrayValue),
	array('id'=>1,'name'=>'Mari','age'=>23,'array'=>$arrayValue),
	array('id'=>2,'name'=>'Getter','age'=>25,'array'=>$arrayValue),
	array('id'=>3,'name'=>'Jaanika','age'=>12,'array'=>$arrayValue),
	array('id'=>4,'name'=>'SSSSS','age'=>23,'array'=>$arrayValue),
	array('id'=>5,'name'=>'Wrony','age'=>54,'array'=>array()),
	array('id'=>6,'name'=>'Oliver','age'=>15,'array'=>$arrayValue),
	array('id'=>7,'name'=>'Mari','age'=>23,'array'=>$arrayValue),
	array('id'=>8,'name'=>'Getter','age'=>25,'array'=>$arrayValue),
	array('id'=>9,'name'=>'Jaanika','age'=>12,'array'=>$arrayValue),
), 18);
$source->searchKeys( array('name','age') );

if( $post->doSearch ) {
	$post->store('doSearch','searchWord');
	$source->where( $post->searchWord );
} 
			
if( isset($_GET['doSomethingValue']) ) {
	$warning = array(
		'type' => 'warning',
		'message' => 'You wanted to do something with element nr '.$_GET['doSomethingValue'],
		'colspan' => 3,
	);
}
		
			
function ageHandler( $value ) {
	return $value.' aastat';
}	
		
$grid = array(
	'title' => 'Grid',
	'style' => 'width: 800px',
	'action' => $this->getUrl('simpleGrid/'),
	'layout' => 'table',
	'layoutConfig' => array(
		'columns' => 3,
		'columnWidths' => array(150,150),
	),
	'items' => array(
		$warning,
		array(
			'type' => 'title',
			'value' => 'Otsi',
		),
		array(
			'type' => 'textField',
			'name' => 'searchWord',
			'value' => $post->searchWord,
		),
		array(
			'type' => 'button',
			'name' => 'doSearch',
			'title' => 'Otsi',
		),
		array(
			'type' => 'grid',
			'name' => 'SampleGrid',
			'colspan' => 3,
			'link' => $this->getUrl('simpleGrid'),
			'source' => $source,
			'fields' => array(
				array(
					'title' => 'Name',
					'key' => 'name',
					'allowOrderBy'=>true,
					'link' => $this->getUrl('editGridItem/'),
				),
				array(
					'title' => 'Age',
					'key' => 'age',
					'handler' => 'ageHandler',
				),
				array(
					'title' => 'Some value',
					'key' => array('array','key','value'),
				),
				array(
					'type' => 'gridButton',
					'confirmMessage' => 'Are you sure you want to do that?',
					'value' => 'Press me',
					'link' => $this->getUrl('simpleGrid/&doSomethingValue=[$id]'),
				),
			),
		),
	),
);
		
$this->view->contents = DomFg::render( $grid );
?&gt;
</pre>
</div>
{/literal}